package com.eva.news.client.api.cms;

import com.eva.news.cms.biz.search.DefaultSearchBiz;
import com.eva.news.cms.biz.search.vo.SearchResultVO;
import com.eva.news.framework.common.api.BaseController;
import com.eva.news.framework.common.model.ApiResponse;
import com.eva.news.framework.common.model.PageWrap;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Api(tags = "搜索接口")
@RestController
@RequestMapping("/search")
public class SearchController extends BaseController {

    @Resource
    private DefaultSearchBiz defaultSearchBiz;

    @ApiOperation("站内搜索")
    @PostMapping()
    public ApiResponse<SearchResultVO> search(@RequestBody PageWrap<String> pageWrap) {
        return ApiResponse.success(defaultSearchBiz.search(pageWrap));
    }
}
